#!/bin/bash -l

while [ ! -f $mylock.$myid ] ; do
  if [ ! -f $mylock ] ; then sleep 1; fi
  mv $mylock $mylock.$myid >& /dev/null
  if [ ! -f $mylock.$myid ] ; then sleep 1; fi
done

